<template>
  <div>
    <el-button type="primary" @click="add">添加</el-button>
    <v-add :obj="obj" ref="oCh"></v-add>
    <v-list :obj="obj" @edit="edit"></v-list>
  </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import vList from "../role/components/list.vue";
import vAdd from "../role/components/add.vue";
export default {
  props: [],
  components: {
    vList,
    vAdd,
  },
  data() {
    return {
      obj:{
        //控制对话框显示/隐藏
        isTrue:false,
        //用来标识点击了添加还是编辑
        isAdd:false
      }
    };
  },
  computed: {
    ...mapGetters({}),
  },
  methods: {
    ...mapActions({}),
    add(){
      //让对话框弹出
      this.obj.isTrue=true
      //标识点击的是添加按钮
      this.obj.isAdd=true
    },
    edit(id){
      this.$refs.oCh.getInfo(id);
    }
  },
  mounted() {},
};
</script>
<style scoped>
</style>